/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import { Request, Response } from 'express';
import { ResponseItem, responseSuccess } from '../utils';
import Mock from 'mockjs';
export default {
  'POST /CustomLottery/searchLottery': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: Mock.mock({
        'list|1-4': [
          {
            id: '@id',
            name: '@cname()',
            desc: '描述\n描述\n描述',
            'rank|1-10': 10,
            'number|1-10000': 10000,
            ad_url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
            'platform|1': ['weikuaidi', 'vxmina', 'kbylmina'],
            lottery_time: '@now()',
            prize_param:
              '[{ "ranking":1,"number":"40","money":"2","name":"1元寄件红包","prize_type":"money" },{ "ranking":2,"number":"100","money":"0","name":"1元寄件优惠券","prize_type":"url","appid":"wxfaeec4255298e6c6","page":"pages/welfare/welfare?url=welfare","half_open":"1" },{ "ranking":3,"number":"1000","money":"0","name":"定制USB迷你风扇","prize_type":"url","appid":"wx61de8f0176155640","page":"pages/mart/mart?spuid=100131&couponId=29&source=kbyl_mrcj","half_open":0 }]',
            'status|1': ['0', '1'],
            'publish|1': ['0', '1'],
            'is_lottery|1': ['0', '1'],
            real_lottery_id: '@id',
            operate_mobile: '13015440211',
            is_deleted: '0',
            created_at: '2023-02-17 14:20:46',
            updated_at: '2023-02-17 14:20:46',
          },
        ],
        count: '4',
      }),
    };
    return res.json(result);
  },
  'POST /CustomLottery/operationLog': (req: Request, res: Response) => {
    const data = Mock.mock({
      'list|1-30': [
        {
          id: '@id()',
          'action|1': ['add', 'online', 'offline', 'update', 'delete'],
          lottery_id: '@id()',
          created_at: '@now()',
          updated_at: '@now()',
          name: '@cname()',
          mobile: '@phone()',
        },
      ],
    });
    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: {
        list: data.list,
        total: data.list.length,
      },
    };
    return res.json(result);
  },
  'POST /CustomLottery/exportLottery': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: 'https://upload.kuaidihelp.com/admin/1.xlsx',
    };
    return res.json(result);
  },
  'POST /CustomLottery/onlineLottery': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /CustomLottery/deleteLottery': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /CustomLottery/edit': (req: Request, res: Response) => responseSuccess(req, res),
};
